package xfsale.exception;

public class AppException extends RuntimeException {

	public static final String ERROR_CODE_APP = "8001";
	public static final String ERROR_CODE_DB = "8002";
	public static final String ERROR_CODE_IO = "8003";
	public static final String ERROR_CODE_RT = "8004";

	private String errorCode;
	private String errorMsg;

	public AppException() {
		super();
	}

	public AppException(String errorCode, String errorMsg) {
		this.errorCode = errorCode;
		this.errorMsg = errorMsg;
	}

	public AppException(String errorMsg) {
		this(ERROR_CODE_APP, errorMsg);
	}

	public String getErrorCode() {
		return errorCode;
	}

	public void setErrorCode(String errorCode) {
		this.errorCode = errorCode;
	}

	public String getErrorMsg() {
		return errorMsg;
	}

	public void setErrorMsg(String errorMsg) {
		this.errorMsg = errorMsg;
	}

	public String getMessage() {
		return "APP-" + errorCode + " " + errorMsg;
	}

	public String toString() {
		return getMessage();
	}
}
